MODEL_BASE = '_metaclass_helper_'


def with_metaclass(meta, base=object):
    return meta(MODEL_BASE, (base,), {})


class ModelBase(type):
    def __new__(cls, name, bases, attrs):
        if name == MODEL_BASE or bases[0].__name__ == MODEL_BASE:
            print(2222)
            return super(ModelBase, cls).__new__(cls, name, bases, attrs)

        meta_options = {}
        print(111111)

print(ModelBase(MODEL_BASE, (object,), {}))
class Modal(ModelBase(MODEL_BASE, (object,), {})):
    pass



class User(Modal):
    pass


class Modal2(type(MODEL_BASE, (object, ), {})):
    pass


if __name__ == '__main__':
    print('mmm', Modal2())